﻿using System;

public class Class1
{
	public Class1()
	{



        //public override void Save2()
        //{

        //    //backupDS?
        //    EndEdits();
        //    //this.Validate();
        //    //this.faturaBindingSource.EndEdit();
        //    //this.faturaDetayBindingSource.EndEdit();
        //    tableAdapterManager.UpdateAll(ds);

        //    //DataRow[] rowsToSubmit;
        //    //rowsToSubmit = ds.Fatura.Select("", "", Added);
        //    //if (rowsToSubmit.Length != 0) numberOfChangesSubmitted += this.faturaTableAdapter.Update(rowsToSubmit);

        //    //rowsToSubmit = ds.FaturaDetay.Select("", "", Added);
        //    //if (rowsToSubmit.Length != 0) numberOfChangesSubmitted += this.faturaDetayTableAdapter.Update(rowsToSubmit);

        //    //rowsToSubmit = ds.FeatureKumas.Select("", "", Added);
        //    //if (rowsToSubmit.Length != 0) numberOfChangesSubmitted += this.featureKumasTableAdapter.Update(rowsToSubmit);

        //    //rowsToSubmit = ds.Roll.Select("", "", Added);
        //    //if (rowsToSubmit.Length != 0) numberOfChangesSubmitted += this.rollTableAdapter.Update(rowsToSubmit);

        //    ////Submit deleted orders
        //    //rowsToSubmit = ds.Roll.Select("", "", Deleted);
        //    //if (rowsToSubmit.Length != 0) numberOfChangesSubmitted += this.rollTableAdapter.Update(rowsToSubmit);

        //    //rowsToSubmit = ds.FeatureKumas.Select("", "", Deleted);
        //    //if (rowsToSubmit.Length != 0) numberOfChangesSubmitted += this.featureKumasTableAdapter.Update(rowsToSubmit);

        //    //rowsToSubmit = ds.FaturaDetay.Select("", "", Deleted);
        //    //if (rowsToSubmit.Length != 0) numberOfChangesSubmitted += this.faturaDetayTableAdapter.Update(rowsToSubmit);

        //    //rowsToSubmit = ds.Fatura.Select("", "", Deleted);
        //    //if (rowsToSubmit.Length != 0) numberOfChangesSubmitted += this.faturaTableAdapter.Update(rowsToSubmit);

        //    ds.AcceptChanges();
        //}


        //// Reject changes on rows with errors and clear the error.
        //DataRow[] errRows = dataSet.Tables["Customers"].GetErrors();
        //foreach (DataRow errRow in errRows)
        //{
        //    errRow.RejectChanges();
        //    errRow.RowError = null;
        //}

        
        //public void Savex()
        //{
        //    //DataSet dataSetSavePoint = ds.Copy();
        //    saving = true;

        //    EndEdits();
        //    if(ds.HasChanges())
        //        try
        //        {
        //            numberOfChangesSubmitted = 0;
        //            using (TransactionScope txn = new TransactionScope())
        //            {
        //                try
        //                {
        //                    this.connection.Open();
        //                }
        //                catch (Exception openFailedException)
        //                {
        //                    MessageBox.Show(openFailedException.Message, "Unable to connect to retrieve data", MessageBoxButtons.OK, MessageBoxIcon.Hand);
        //                    return;
        //                }

        //                Save2();

        //                if (numberOfChangesSubmitted == 0)
        //                {
        //                    Notify("No changes to submit");
        //                    return;
        //                }
        //                txn.Complete();
        //            }
        //            Notify(string.Format("Successfully submitted {0} changes", numberOfChangesSubmitted));
        //        }
        //        catch (Exception ex)
        //        {
        //            //                MessageBox.Show(ex.Message, "Update failed!", MessageBoxButtons.OK, MessageBoxIcon.Error);
        //            if (MessageBox.Show(ex.Message + Environment.NewLine + Environment.NewLine + "Would you like to restore the previous state?", "Update failed!", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
        //            {
        //                ds.RejectChanges();
        //                //ds.Clear();
        //                //ds.Merge(dataSetSavePoint);
        //            }
        //        }
        //        finally
        //        {
        //            connection.Close();
        //        }

        //    saving = false;
        //}


        //private void btnModified_MouseHover(object sender, EventArgs e)
        //{
        //    DataRow dr = ((DataRowView)(bs[0].Current)).Row;
        //    if (dr.RowState != DataRowState.Detached)
        //        if (!dr.IsNull("ModifiedBy"))
        //            UpdatedBy.Text = dsrepository.Employee.FindByEmployeeId(int.Parse(dr["ModifiedBy"].ToString())).LoginId + " * " + dr["ModifiedOn"].ToString();
        //}

        //private void btnModified_MouseLeave(object sender, EventArgs e)
        //{
        //    UpdatedBy.Text = "UpdatedBy";
        //}




        //        Datagrid Alert by delete of rows AddHandler ds.Tables(0).RowDeleted, _
        //        New DataRowChangeEventHandler(AddressOf Row_Delete)
        //Private Sub Row_Delete(ByVal sender As Object, ByVal e _
        //    As DataRowChangeEventArgs)
        //        If e.Action = DataRowAction.Delete Then
        //            If MessageBox.Show("Delete row? ", _
        //            "", MessageBoxButtons.OKCancel) = DialogResult.Cancel Then
        //                e.Row.RejectChanges()
        //            End If
        //       End If
        //End Sub



        //sourceNav.Position = sourceNav.Find("faturaId", faturaId);

        //public override void AddNewItem()
        //{
            //bs[0].AddNew();
        //}



        
        //public override void EndEdit2()
        //{
        //    //if (bs[1].Current != null)
        //    //    ((DataRowView)(bs[1].Current)).Row["StokId"] = PullData(0, "StokId");
        //}

        //public override void AddNewItem()
        //{
        //    //PushData("FaturaId", FaturaId);
        //    bs[1].AddNew();
        //    bs[2].AddNew();
        //}


        
        //private static void Notify(string str)
        //{
        //    timer1.Enabled = false;
        //    sLabelX.Caption = str;
        //    timer1.Enabled = true;
        //}

        //private void Base2_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e)
        //{
        //    EndEdits();

        //    if (ds1.GetChanges() != null)
        //    {
        //        DialogResult dr = MessageBox.Show("Değişiklikleri kaydetmediniz. Kaydedilsin mi?", "caption", MessageBoxButtons.YesNo);
        //        if (dr == DialogResult.Yes)
        //            Save();
        //        else
        //            ds1.RejectChanges();
        //    }
        //}

        //public void EndEdits()
        //{
        //    this.Validate();
        //    foreach (BindingSource bss in bs)
        //        bss.EndEdit();
        //    EndEdit2();
        //}


        
        //public string PullData(int i, string colName)
        //{
        //    return ((DataRowView)(bs[i].Current)).Row[colName].ToString();
        //}

        //public void PushData(string colName, object Val)
        //{
        //    if (bs[0].Current != null)
        //        ((DataRowView)(bs[0].Current)).Row[colName] = Val;
        //}

        //private void toolStripButton1_Click(object sender, EventArgs e)
        //{
        //    this.Close();
        //}

        //private void bindingNavigatorSaveAll_Click(object sender, EventArgs e)
        //{
        //    EndEdits();
        //    Save();
        //}


        //        private void InitDataNavigator()
        //{
        //    dataNavigator1.Buttons.ImageList = ımageList1;
        //    for (int i = 0; i < dataNavigator1.Buttons.ButtonCollection.Count; i++)
        //        dataNavigator1.Buttons.ButtonCollection[i].ImageIndex = i;
        //}


        //if (adding) return;

        //adding = true;
        //DataRowView dr = ((DataRowView)bs2.AddNew());
        //bs2.MoveLast();

        //dr["AddressId"] = int.Parse(((DataRowView)bs3.Current).Row["AddressId"].ToString());
        //e.NewObject = dr;
        //bs2.EndEdit();
        //adding = false;

        //string[] del = new string[] { "!" };
        //string[] tableNames = "AddressType!AlisSekli!BelgeTipi!Carrier!ContactType!Country!Culture!Currency!Customer!CustomerBrand!DeliveryTerm!Department!Employee!ExpensePercentage!HareketTipi!Location!Origin!PaymentTerm!Product!ProductCategory!ProductSubcategory!SalesAgent!SalesPerson!Shelf!ShipMethod!StokkoduTipi!UnitMeasure!Vendor".Split(del, StringSplitOptions.None);

    }
}
